package xyz.wanwanwan.www.hrm.feign.fallback;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import xyz.wanwanwan.www.hrm.domain.CourseDetail;
import xyz.wanwanwan.www.hrm.feign.client.CourseDetailClient;
import xyz.wanwanwan.www.hrm.util.AjaxResult;

@Component
@Slf4j
public class CourseDetailClientFallbackFactory implements FallbackFactory<CourseDetailClient> {
    @Override
    public CourseDetailClient create(Throwable throwable) {
        return new CourseDetailClient() {
            @Override
            public CourseDetail get(Long id) {
                log.error("课程详情回调，查询课程详情失败");
                return new CourseDetail(-1L,"课程详情回调，查询课程详情失败",null);
            }
        };
    }
}
